package com.luyue.zagj.adapter;

import android.graphics.Color;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.jude.easyrecyclerview.adapter.BaseViewHolder;
import com.luyue.zagj.R;
import com.luyue.zagj.domin.News;

/**
 * Created by luyue on 2016/11/21.
 * // 用News 实体类做演示，实际使用时 根据 接口传回数据做改变
 *   显示结果位演示 而是用随机数据 实际使用时候 使用List传回数据
 */

public class ReportViewHolder extends BaseViewHolder<News> {


    private ImageView mImg_face;
    private TextView mTv_sign;
    private TextView mTv_brand;
    private TextView mTv_loc;
    private TextView mTv_type;

    public ReportViewHolder(View itemView) {
        super(itemView);
    }

    public ReportViewHolder(ViewGroup parent) {
        super(parent, R.layout.report_recycler_item);
        mTv_brand = $(R.id.person_brand);
        mTv_sign = $(R.id.person_sign);
        mImg_face = $(R.id.person_face);
        mTv_loc = $(R.id.person_loc);
        mTv_type = $(R.id.person_type);
    }

    @Override
    public void setData(final News data) {
        int n= (int) (Math.random() * 2+1);
        switch (n){
            case 1:
                mTv_brand.setText("品牌：奥玛");
                mTv_loc.setText("丢失地点：萧山国际机场");
                mTv_type.setText("状态：已处理");
                mTv_type.setTextColor(Color.parseColor("#009900"));
                Glide.with(getContext())
                        .load(R.mipmap.police)
                        .placeholder(R.mipmap.ic_launcher)
                        .centerCrop()
                        .into(mImg_face);
                break;
            case 2:
                mTv_brand.setText("品牌：飞速");
                mTv_loc.setText("丢失地点：余杭区天使小镇");
                mTv_type.setText("状态：处理中");
                mTv_type.setTextColor(Color.parseColor("#CC0000"));
                Glide.with(getContext())
                        .load(R.mipmap.alarmm)
                        .placeholder(R.mipmap.ic_launcher)
                        .centerCrop()
                        .into(mImg_face);
                break;

            default:
                break;
        }


        //     mTv_name.setText(data.getTitle());



        mTv_sign.setText(data.getCtime());



//        Glide.with(getContext())
//                .load(data.getPicUrl())
//                .placeholder(R.mipmap.ic_launcher)
//                .centerCrop()
//                .into(mImg_face);
    }
}
